<!--
  @author yangjiangming
  @date 2018/11/26 10:00
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<div th:fragment="table">


<table class="layui-table" lay-data="{ data: [] }" id="zmn-clue-detail-table" lay-filter="zmn-clue-detail-table" >
    <thead>
        <tr>
            <th lay-data="{ field: 'createTime', title: '推送时间' }">推送时间</th>
            <th lay-data="{ field: 'dutyTime', title: '预约时间' }">预约时间</th>
            <th lay-data="{ title: '用户信息', templet: '#contact-info'}">用户信息</th>
            <th lay-data="{ title: '省市', templet: '#province-city'}">省市</th>
            <th lay-data="{ field: 'addressInfo', title: '地址' }">地址</th>
            <th lay-data="{ title: '服务信息', templet: '#product-info' }">服务信息</th>
            <th lay-data="{ field: 'channelName', title: '下单渠道' }">下单渠道</th>
            <th lay-data="{ field: 'errorMsg', title: '备注' }">备注</th>
            <th lay-data="{ field: 'stateName', title: '处理结果' , align: 'center', templet: '#state-name'}">处理结果</th>
            <th lay-data="{ field: 'operator', title: '操作人' }">操作人</th>
            <th lay-data="{ field: 'updateTime', title: '操作时间' }">操作时间</th>
            <th lay-data="{ field: 'state', title: '操作', align: 'center', width: 165, fixed: 'right', templet: '#btn-operate'}"></th>
        </tr>
    </thead>
</table>

    <script type="text/html" id="contact-info">
        {{ d.contactName }} - {{ d.contactPhone }}
    </script>

    <script type="text/html" id="province-city">
        {{ d.provinceName }} - {{ d.cityName }}
    </script>

    <script type="text/html" id="product-info">
        {{ d.productName }} * {{ d.productNumber }}
    </script>

    <script type="text/html" id="channel-info">
        {{ d.facadeName }} - {{ d.channelName }}
    </script>

    <script type="text/html" id="state-name">
        {{# if (d.state == 0) { }}
        <span class="layui-badge" style="background-color:#FF3333">待处理</span>
        {{# } }}
        {{# if (d.state == 1) { }}
        <span class="layui-badge" style="background-color:#333333">已舍弃</span>
        {{# } }}
        {{# if (d.state == 2) { }}
        <span class="layui-badge" style="background-color:#999999">生成工单-处理中</span>
        {{# } }}
        {{# if (d.state == 3) { }}
        <span class="layui-badge" style="background-color:#009688">已成单</span>
        {{# } }}
    </script>

    <script type="text/html" id="btn-operate">
        {{# if (d.state == 0) { }}
        <a class="layui-btn layui-btn-sm" lay-event="ignoreOrderClueDetail">舍弃</a>
        <a class="layui-btn layui-btn-sm" lay-event="apply2ZmnOrder">生成工单</a>
        {{# } }}
        {{# if (d.state == 1) { }}
        <a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="resetState2Pending">恢复线索</a>
        {{# } }}
        {{# if (d.state == 2) { }}
        <a class="layui-btn layui-btn-sm layui-btn-disabled" >生成工单</a>
        {{# } }}
        {{# if (d.state == 3) { }}
        <a class="layui-btn layui-btn-sm" lay-event="detail">工单详情</a>
        {{# } }}
    </script>
</div>